// logs.ts
// const util = require('../../utils/util.js')
import { formatTime } from '../../utils/util'

interface LogItem {
  date: string;
  timeStamp: number;
}

Page({
  data: {
    logs: [] as LogItem[]
  },
  onLoad() {
    // 页面加载时获取日志
    this.setData({
      logs: (wx.getStorageSync('logs') || []).map((log: number) => {
        return {
          date: formatTime(new Date(log)),
          timeStamp: log
        }
      })
    })
  }
})
